package cn.tedu.oop2;
/*本类用于完成汽车设计案例*/
public class DesignCar {
    public static void main(String[] args) {
        Car c = new Car();
        System.out.println(c.getColor());
        c.stop();
        c.start();
        //c.swim();//父类不可以调用子类的特有功能
        BMV b = new BMV();
        System.out.println(b.color);
        System.out.println(b.getColor());
        b.stop();
        b.start();
        Car c2 = new TSL();
        System.out.println(c2.getColor());
        c2.start();
        c2.stop();
//        c2.swim();
    }
}
class Car{
    private String brand;
    private String color;
    private int id;//编号
    private double price;

    public void start(){
        System.out.println("艾欧尼亚，我的小车启动啦");
    }

    public void stop(){
        System.out.println("唉呀妈呀，熄火了~");
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
}


class BMV extends Car{
    String color = "炽火白";
    @Override
    public void start(){
        System.out.println("都让开，我得车要起飞啦~");
    }
}

class TSL extends Car{

    @Override
    public void stop(){
        System.out.println("唉呀妈呀，怎么停不下来了");
    }
    public void swim(){
        System.out.println("没想到吧，为还是个潜水艇");
    }
}